#include<stdio.h>
int gcd(int a,int b)
{
    return b?gcd(b,a%b):a;
}
int main()
{
    long long T,x,y,g1,g2,ans1,ans2,a,b;
    scanf("%d",&T);getchar();
    while(T--)
    {
        scanf("%d%d",&x,&y);getchar();
        if(x==0||y==0)
        {
        	printf("-1\n");
        	continue;
		}
        g1=gcd(x,y);
        ans1=x*y/g1;
        a=ans1/x;b=ans1/y;
        g2=gcd(a,b);
        ans2=a*b/g2;
        if(ans1-ans2)
        	printf("-1\n");
        else
        	printf("%d %d %d\n",a,b,ans1);
    }
    return 0;
}
